Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exporter.OpenTelemetryProtocol] fix event source throws System.FormatException #5451

Merged
merged 5 commits into from
Mar 14, 2024

Conversation

TimothyMothra
Copy link
Contributor

This PR fixes a bug in the PersistentStorageEventSource class.

System.FormatException
  HResult=0x80131537
  Message=Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
  Source=System.Private.CoreLib
  StackTrace:
   at System.ThrowHelper.ThrowFormatIndexOutOfRange()
   at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
   at System.String.Format(IFormatProvider provider, String format, Object[] args)
   at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.OpenTelemetryEventListener.OnEventWritten(EventWrittenEventArgs eventData) in C:\Users\Rohit Ranjan\source\repos\azure-functions-host\src\WebJobs.Script.WebHost\Diagnostics\OpenTelemetryEventListener.cs:line 54
   at System.Diagnostics.Tracing.EventSource.DispatchToAllListeners(EventWrittenEventArgs eventCallbackArgs)

Changes

  • fix index in Event attribute.
  • Update test class to verify all event source classes in this project.

@TimothyMothra TimothyMothra requested a review from a team March 14, 2024 21:38
@TimothyMothra TimothyMothra changed the title [Exporter.OpenTelemetryProtocol] fix event source [Exporter.OpenTelemetryProtocol] fix event source throws System.FormatException Mar 14, 2024
@@ -14,4 +16,16 @@ public void EventSourceTest_OpenTelemetryProtocolExporterEventSource()
{
EventSourceTestHelper.MethodsAreImplementedConsistentlyWithTheirAttributes(OpenTelemetryProtocolExporterEventSource.Log);
}

[Fact]
public void EventSourceTest_PersistentStorageAbstractionsEventSource()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.37%. Comparing base (6250307) to head (9ab9e17).
Report is 132 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5451      +/-   ##
==========================================
+ Coverage   83.38%   85.37%   +1.98%     
==========================================
  Files         297      289       -8     
  Lines       12531    12422     -109     
==========================================
+ Hits        10449    10605     +156     
+ Misses       2082     1817     -265     
Flag Coverage Δ
unittests ?
unittests-Solution-Experimental 85.37% <ø> (?)
unittests-Solution-Stable 85.33% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../PersistentStorage/PersistentStorageEventSource.cs 46.00% <ø> (+46.00%) ⬆️

... and 62 files with indirect coverage changes

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good reason why to move to ILogger #3881.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants